package com.atwei.mango.business.hello.controller;

import com.atwei.mango.business.hello.service.HelloService;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author liuwei
 * @date 2021/10/15 9:14
 */
@RestController
@RequestMapping(value = "/hello")
public class HelloController {

    @Resource(name = "helloServiceImpl")
    HelloService helloService;

    @Resource(name = "helloSlaveServiceImpl")
    HelloService helloSlaveService;

//    private final HelloService helloService;
//    private final HelloService helloSlaveService;
//    @Autowired
//    public HelloController(HelloServiceImpl helloService, HelloSlaveServiceImpl helloSlaveService){
//        this.helloService = helloService;
//        this.helloSlaveService = helloSlaveService;
//    }

    @GetMapping("")
    public String helloWorld(){
        //多数据源&mybatis测试
//        helloService.testMybatisPlus();
        helloService.testMybatis();
        return "helloWorld";
    }

    @GetMapping("helloBack")
    public String helloBack(@Param("hello") String hello){
        System.out.println(hello);
        return "hello back!";
    }

}
